import http from "@/utils/http";
import type * as Project from "./type";

/**
 * 验收标准模块
 */
export const standardTemplateTree = () => {
  return http.get<Project.StandardData[]>("/crm/checkStandard/list");
};

/**
 * 通过流程业务key获取标准信息
 */
export const standardInfoByBusinessKey = (businessKey: string) => {
  return http.get<any>(`/crm/checkStandard/getCheckStandardByBusinessKey/${businessKey}`);
};
/**
 * 查询验收标准详情
 */
export const standardTemplateDetail = (templateId: string) => {
  return http.get<Project.DetailRes>(`/crm/checkStandard/getInfo/${templateId}`);
};

/**
 * 编辑验收标准
 */
export const standardTemplateEdit = (data: Project.DetailRes) => {
  return http.put("/crm/checkStandard/update", data);
};

/**
 * 树开关
 */
export const changeTreeSwitch = (standardId: string, standardState: 0 | 1) => {
  return http.put(`/crm/checkStandard/enable/${standardId}?standardState=${standardState}`);
};
/**
 * 默认
 */
export const defaultDetail = (standardId: string, isDefault: 0 | 1) => {
  return http.put<Project.StandardData[]>(`/crm/checkStandard/isDefault/${standardId}?isDefault=${isDefault}`);
};
/**
 * 引用
 */
export const getCiteData = (templateId: string) => {
  return http.get(`/dbo/standardTemplate/getCheckStandardTemplateInfo/${templateId}`);
};
